home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / FILES.SWG / 0032_Change File Attr.pas < prev    next >
Pascal/Delphi Source File  |  1993-11-02  |  873b  |  40 lines

  1. {
  2. avictor@cs.sun.ac.za (Andrew Victor 93-42265)
  3.  
  4. I want this Program to change the hidden attributes of a directory.
  5.  
  6.  - Parameter FileName of Type String is the Name of the
  7.  - subdirectory to hide or un-hide, it can include a path.
  8. }
  9.  
  10.  
  11. Procedure ChangeAttributes(FileName : String);
  12. Var
  13.   AttrFile  : File;
  14.   Attribute : Word;
  15. begin
  16.   Assign(AttrFile, FileName);
  17.   GetFAttr(AttrFile, Attribute);
  18.   if not ((Attribute = $10) or (Attribute = $12)) then
  19.   begin
  20.     WriteLn;
  21.     WriteLn('Not a Directory');
  22.     WriteLn;
  23.     Exit;
  24.   end;
  25.   if Attribute = $10 then
  26.   begin
  27.     SetFAttr(AttrFile, Hidden);
  28.     WriteLn;
  29.     WriteLn('Directory ', FileName, ' hidden.');
  30.     WriteLn;
  31.   end
  32.   else
  33.   begin
  34.     SetFAttr(AttrFile, Directory and not Hidden);
  35.     WriteLn;
  36.     WriteLn('Directory ', FileName, ' shown.');
  37.     WriteLn;
  38.   end;
  39. end;
  40.